﻿@page "/user"
@namespace SwashbucklerDiary.Pages
@inherits ImportantComponentBase

<MyAppBar Title="@(I18n.T("User.Title"))"
          OnClick="NavigateToBack">
</MyAppBar>

<ScrollContainer>
    <MCard Elevation="0"
           Rounded="@("lg")">
        <MList>
            <MListItem OnClick="()=>ShowEditAvatar=true">
                <MListItemIcon>
                    <MIcon Class="list-item-icon">
                        mdi-account-circle-outline
                    </MIcon>
                </MListItemIcon>

                <MListItemContent>
                    @(I18n.T("User.Avatar.Name"))
                </MListItemContent>

                <MListItemAction>
                    <MAvatar Rounded="@("lg")"
                             Size="32">
                        <MImage Src="@Avatar">
                            <PlaceholderContent>
                                <MRow Class="fill-height ma-0"
                                      Align="@AlignTypes.Center"
                                      Justify="@JustifyTypes.Center">
                                    <MProgressCircular Indeterminate></MProgressCircular>
                                 </MRow>
                             </PlaceholderContent>
                         </MImage>
                     </MAvatar>
                     <MIcon>mdi-chevron-right</MIcon>
                 </MListItemAction>
             </MListItem>

             <MDivider Class="mx-3"></MDivider>

             <MListItem OnClick="()=>ShowEditUserName=true">
                 <MListItemIcon>
                     <MIcon Class="list-item-icon">
                         mdi-card-account-details-outline
                     </MIcon>
                 </MListItemIcon>

                 <MListItemContent>
                     @(I18n.T("User.UserName.Name"))
                 </MListItemContent>

                 <MListItemContent>
                     <MListItemSubtitle Class="text-right">
                         @UserName
                     </MListItemSubtitle>
                 </MListItemContent>

                 <MListItemAction>
                     <MIcon>mdi-chevron-right</MIcon>
                 </MListItemAction>
             </MListItem>

             <MDivider Class="mx-3"></MDivider>

             <MListItem OnClick="()=>ShowEditSign = true">
                 <MListItemIcon>
                     <MIcon Class="list-item-icon">
                         mdi-file-sign
                     </MIcon>
                 </MListItemIcon>

                 <MListItemContent>
                     <MListItemTitle>
                         @(I18n.T("User.Sign.Name"))
                     </MListItemTitle>

                 </MListItemContent>

                 <MListItemContent>
                     <MListItemSubtitle Class="text-right">
                         @Sign
                     </MListItemSubtitle>
                 </MListItemContent>

                 <MListItemAction>
                     <MIcon>mdi-chevron-right</MIcon>
                 </MListItemAction>
             </MListItem>
         </MList>
     </MCard>
 </ScrollContainer>

 <MultiListDialog @bind-Value="ShowEditAvatar"
              Title="@(I18n.T("User.EditAvatar"))"
              DynamicListItems="EditAvatarMethods">
 </MultiListDialog>

 <InputDialog @bind-Value="ShowEditUserName"
              Text="@UserName"
              Title="@(I18n.T("User.EditUserName"))"
              Placeholder="@(I18n.T("User.UserNamePlace"))"
              OnOK="SaveUserName">
 </InputDialog>

 <InputDialog @bind-Value="ShowEditSign"
              Text="@Sign"
              Title="@(I18n.T("User.EditSign"))"
              MaxLength="100"
              Placeholder="@(I18n.T("User.SignPlace"))"
              OnOK="SaveSign">
 </InputDialog>
